#pragma once

#include <memory>
#include "Containers/ThreadSafePtr.h"
#include "Containers/Map.h"

class CPreRenderTexture2D;
class CPreRenderTextureCube;
class CPreRenderMesh;
class CPreRenderMaterial;
class CPreRenderShader;
class CAllPreRenderData;

class CTexture2DPixels;
class CWriteInTextureCube;
class CWriteInMesh;
class CWriteInShader;

class CRenderTexture2D;
class CRenderTextureCube;
class CRenderMesh;
class CRenderShader;
class CRenderMaterial;


//预处理渲染上下文
struct SPreRenderContext
{
public:
    CAllPreRenderData* Result;

    std::shared_ptr<CPreRenderTexture2D> PreRender(std::shared_ptr<CRenderTexture2D> Texture);
    std::shared_ptr<CPreRenderTextureCube> PreRender(std::shared_ptr<CRenderTextureCube> Texture);
    std::shared_ptr<CPreRenderMesh> PreRender(std::shared_ptr<CRenderMesh> Mesh);
    std::shared_ptr<CPreRenderShader> PreRender(std::shared_ptr<CRenderShader> Shader);
    std::shared_ptr<CPreRenderMaterial> PreRender(std::shared_ptr<CRenderMaterial> Material);
protected:
    TMap<TThreadSafeSharedPtr<CTexture2DPixels>, std::shared_ptr<CPreRenderTexture2D>> Texture2DMap;
    TMap<TThreadSafeSharedPtr<CWriteInTextureCube>, std::shared_ptr<CPreRenderTextureCube>> TextureCubeMap;
    TMap<TThreadSafeSharedPtr<CWriteInMesh>, std::shared_ptr<CPreRenderMesh>> MeshMap;
    TMap<TThreadSafeSharedPtr<CWriteInShader>, std::shared_ptr<CPreRenderShader>> ShaderMap;
    TMap<std::shared_ptr<CRenderMaterial>, std::shared_ptr<CPreRenderMaterial>> MaterialMap;
};